FILEUTILS_SRC = test-fileutils.c ../src/fileutils.c
STRINGUTILS_SRC = test-stringutils.c
THREADPOOL_SRC = test-threadpool.c ../src/ds/threadpool.c

COMMON_SRC = ../src/util/logging.c ../src/util/tester.c ../src/ds/stringutils.c
COMMONCFLAGS = -Wall -Wextra -Wpedantic -g -O2 -I../include -DSEx_LOGGING -D_DEFAULT_SOURCE -D_GNU_SOURCE

all: clean prepare compile-all run-all
compile-all: fileutils stringutils

run-all:
	@echo ""
	@echo "Running all tests:"
	bin/fileutils
	bin/stringutils
#	bin/threadpool

clean:
	rm -rf bin

prepare:
	mkdir -p bin

fileutils:
	${CC} ${FILEUTILS_SRC} ${COMMON_SRC} ${COMMONCFLAGS} ${CFLAGS} -o bin/fileutils

stringutils:
	${CC} ${STRINGUTILS_SRC} ${COMMON_SRC} ${COMMONCFLAGS} ${CFLAGS} -o bin/stringutils

threadpool:
	${CC} ${THREADPOOL_SRC} ${COMMON_SRC} ${COMMONCFLAGS} ${CFLAGS} -o bin/threadpool -lpthread

.PHONY: all
